#################################################################################
#										#
# This file is created for the understanding of the files in this directory	#
#		Please go through this file before running simulations		#
#	Created by Arijit Banerjee<ab9ca@Virginia.Edu> for VLSI 6332 Project,	#
#	Dated: 12/11/2012							#
#################################################################################

Note: This setup is only for BSN chip subthreshold SRAM memory in IBM 130nm Technology and the tool to run
the simulation is Synopsys HSIM. Kindly search UVa ECE wiki for HSIM setup. A well-defined PDF file is there
to start with the setup process of HSIM. This document is written as brief as possible to convey enough information
so that a future student group doing a follow-on project can learn from what I did.

a)
Naming Convention of the Run Folder:
-----------------------------------
Folder name of the simulation directory has to be in the format of DataMem_LER_Sims_<Voltage in Volts>V_<Temperature in degree Centigrade>C. If the user wants to run simulation, copy this folder and modify the same in the above naming style.

Example: DataMem_LER_Sims_0.35V_27C
For compatibility with the data extraction script named "getData.pl" the user have to name this run folder in the above format
else the script will not work.


b)
File List and Usage:
--------------------
The list of eighteen files in this folder is provided below:
1) SRAM_Deck_0.5v_Margin_us_ff.sp
2) SRAM_Deck_0.5v_Margin_us_tt.sp
3) SRAM_Deck_0.5v_Margin_us_ss.sp
4) SRAM_Deck_0.5v_Margin_us_sf.sp 
5) SRAM_Deck_0.5v_Margin_us_fs.sp
6) DATA_MEM.sp
7) SRAM_Deck_0.5v.vec_us.stimulus
8) SRAM_Deck_0.5v.vec_us_ff.stimulus
9) Probe.inc
10)HSIM.inc
11)Meas.inc
12)run_1.exe
13)run.exe
14)getData.pl
15)SRAMPlots.xlsx
16)README.txt
17)DATA_MEM_TOP_NOV2012_FINAL.calibre.db
18)syn_setup

We have five simulation decks in the folder as provided below:
SRAM_Deck_0.5v_Margin_us_ff.sp
SRAM_Deck_0.5v_Margin_us_tt.sp
SRAM_Deck_0.5v_Margin_us_ss.sp
SRAM_Deck_0.5v_Margin_us_sf.sp 
SRAM_Deck_0.5v_Margin_us_fs.sp

You must check your simulation file for completeness before firing
simulations. Before running simulations check if all the files mentioned in the
simulation decks are presents or not. If anything in the simulation decks are
not physically present try to find the path.

The one and only netlist is 4KB BSN chip subthreshold data memory which is
named as "DATA_MEM.sp". Do not modify this file.
There are two stimulus file present in this directory for sample simulation
run as "SRAM_Deck_0.5v.vec_us.stimulus" and "SRAM_Deck_0.5v.vec_us_ff.stimulus" and the last one is for FF process simulations
and for all other processes use the first one.

We also have include-files for the simulation decks as listed below:
Probe.inc
HSIM.inc
Meas.inc

In the file "Probe.inc" you should provide node names to be dumped for waveform viewing.[See more in HSIM manual for print statement]

The "HSIM.inc" file has HSIM accuracy settings which is necessary for subthreshold simulations. Do not modify this file.

The "Meas.inc" file is for measuring different parameters of the Subthreshold SRAM like cycle time, access time, read/write average energy etc. The user can change the file if needed.[See more in HSIM manual for measurement statement]

The files "run_1.exe", and "run.exe" have run command written for HSIM for batch mode simulation running.

Note: If you find that the model files are inaccessible contact System Admin Gary Li <garyli@virginia.edu>.

The file named "getData.pl" is a perl script to process *.mt measurement files
into comma separetd value files for important timing and energy parameters of
the subthreshold SRAM. Do not change this file unless you know Perl.

The file named "SRAMPlots.xlsx" is an XL worksheet for important plot
generation for the subthreshold SRAM. Kindly open the file in MS Excel to view
the plot templates and titles.

The file named "README.txt" is the same file you are reading.

The file named "DATA_MEM_TOP_NOV2012_FINAL.calibre.db" is the layout databse
in db format which can be used for commandline DRC, LVS and XRC along with the
input netlist DATA_MEM.sp.

The file named "syn_setup" is for HSIM setup.


c) Running Simulations:
----------------------
We have two run files "run_1.exe", and "run.exe". Before firing the files you need to setup HSIM using bash cell.
Run the following command to setup HSIM
bash
. syn_setup 
csh

Now you are ready to run the simulations as HSIM would be setup by now.

Now open the files in gvim editor by typing the below commands
gvim run_1.exe

You will see some lines are commented and some lines are not. The commented lines can be uncommented to run a definite 
simulation setup. There are only six lines in the file and only five of them contain HSIM run command. Comment or uncomment
the HSIM batch mode commands as per requirement.

To run actual simulations now you can run the below command
csh run_1.exe
This will fire maximum of five simulations in HSIM batch mode.

The file name run.exe is for a different kind of simulation for measuring parameters with and existing *.fsdb file which contains
simulation data.
Hence for re-measurement of some parameters using already dumped simulated data in *.fsdb files using "run.exe."
 

d) Data Collection and Plots Generation:
---------------------------------------
Standard simulation time for subthreshold memories is 2.5-4 hours and it can
depend on the machine load and other users/programs consuming machine resources
also.

After the simulations are done you will be able to see the *.mt files in which
all the measured parameters are listed with measured values. In order to
generate a comma separated value (CSV) file for XLS worksheet to generate plots for
a single PVT you need to invoke the below command inside the simulation directory after all *.mt files are
generated correctly.

perl  getData.pl

After successful execution of the script you will get a CSV file as Iavg.dat_<Voltage>_<Temperature>C
example:

running the script inside the run folder "DataMem_LER_Sims_0.35V_27C" will
produce a CSV file named "Iavg.dat_0.35_27C" In order to produce the plots
copy the CSV content in the apt PVT pages in the SRAMPlots.xlsx and update the
page accordingly to generate the plots with updated data. You can create your
own plots with the collected data also. While pasting the CSV values be
careful about the reference cell you should paste is the top left corner of
the existing table. The first two pages in the XLS are for reference data and
no need to modify the same.

For any further query contact me at <ab9ca@Virginia.Edu>

